package com.zhulanhua.blogs.controller;

import com.zhulanhua.blogs.Utils.Code;
import com.zhulanhua.blogs.Utils.Result;
import com.zhulanhua.blogs.domain.Image;
import com.zhulanhua.blogs.service.ImagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 图片接口
 * */
@RestController
@RequestMapping("/images")
@CrossOrigin
public class ImageController {

    @Autowired
    ImagesService imagesService;

    /**
     * 上传图片
     * @param base64
     * @deprecated 该请求将返回图片的路劲
     * */
    @PostMapping("/add")
    public Result<List<Image>> save(@RequestBody String[] base64){
        return new Result<>(Code.OK, imagesService.save(base64));
    }
}
